<template>
  <div class="cart">
    <cart-header :type=type></cart-header>
    <keep-alive>
      <router-view></router-view>
    </keep-alive>
    <cart-service></cart-service>
    <cart-footer></cart-footer>
  </div>
</template>

<script>
import CartHeader from "./components/CartHeader";
import CartFooter from "../index/components/Footer";
import CartService from "../index/components/Service";
export default {
  name: "Cart",
  components: {
    CartHeader,
    CartFooter,
    CartService,
  },
  data(){
    return{
      type: '',
      loding: true,
    }
  },
  methods: {
    setType(){
      let path = location.hash;
      if(path === '#/cart'){
        this.type = 1;
      }else if(path === '#/cart/order'){
        this.type = 2;
      }else if('#/cart/orderset'.indexOf(path) !== -1){
        this.type = 3;
      }else if(path === '#/cart/confirm'){
        this.type = 4;
      }
    }
  },
  mounted(){
    this.setType();
  },
  updated(){
    this.setType();
  }
};
</script>

<style lang='scss'>

</style>